77

Build Your Own Remote Control

77

STEP 2—​read input and take action (continued)

            LaunchLink =​ 2

            Call AddMedia(ShowText)

          End If

          ShowText =​ ““

          FirstT =​ 0

          ‘Sleep (1000)

        Else

          ShowText =​ ShowText & CommandWord

          SlideNumber =​ ActivePresentation.SlideShowWindow.View.

CurrentShowPosition

          Call AddCallout(ShowText, SlideNumber)

        End If

      End If

      If CommandWord =​ “X” Then

        MsgBox (“Bye”)

        Exit Sub

      End If

     

    End If

   

   

    Wend

ActivePresentation.Close

End Sub

In step 2 when a “#” is entered, the program goes into “receiving” mode and col­

lects the characters that are entered. These are not displayed until another “#” is en­

tered, signifying the end of the text. Then this text is displayed in the current slide in

a bubble. The different states of the text input are controlled through a variable called

“LaunchLink” in the code above.

The code in step 2 also calls a few other functions. These are provided in Section 4.1.

STEP 2 Functions

Sub NextSlide()

    ActivePresentation.SlideShowWindow.View.Next

End Sub

Sub PreviousSlide()

    ActivePresentation.SlideShowWindow.View.Previous

End Sub

Sub OnSlideShowPageChange()

    Dim i As Integer

    i =​ ActivePresentation.SlideShowWindow.View.CurrentShowPosition

End Sub

Sub AddCallout(ShowText, SlideNumber)

    Dim MyCallout As Shape

    Set sldOne =​ ActivePresentation.Slides(ActivePresentation.SlideShowWindow.

View.CurrentShowPosition)

    On Error GoTo CallOutCreate:

    sldOne.Shapes(“Impromptu”).TextFrame.TextRange.Text =​ ShowText